-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: fix skipped tests #155
Conversation
fdb5183
to
be3ade0
Compare
Support for duration type was missing for some reason. Fixing it.
be3ade0
to
b5b28fc
Compare
Rebased on master |
@@ -343,7 +343,7 @@ CASSANDRA_INTEGRATION_TEST_F(BasicsTests, NoCompactEnabledConnection) { | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't we going to run into this if (!Options::is_cassandra()) { if (server_version_ >= "6.0.0") {
branch when we update Scylla to 6.0?
If so, can you fix this in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, Options::is_cassandra()
actually returns true
for Scylla as well. It's because Scylla identifies as Apache Cassandra
server (such info is retrieved from ccm
).
There are 3 possible CCM:ServerType
enum values:
bool Options::is_cassandra() { return server_type_ == CCM::ServerType::CASSANDRA; }
bool Options::is_dse() { return server_type_ == CCM::ServerType::DSE; }
bool Options::is_ddac() { return server_type_ == CCM::ServerType::DDAC; }
I'm not sure about the difference between the types, but in Scylla's case, the server type is CASSANDRA
. Options::is_scylla_
is a flag responsible for distinguishing between scylla and cassandra.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wth is ddac?! Never heard about it before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b5b28fc
to
a954104
Compare
v1.1: addressed review comment |
std::string scylla_version_prefix = "release:"; | ||
std::string version(version_string); | ||
if (version.compare(0, scylla_version_prefix.size(), scylla_version_prefix) == 0) { | ||
version = "3.0.8"; | ||
version.replace(0, scylla_version_prefix.size(), ""); | ||
} | ||
std::replace(version.begin(), version.end(), '.', ' '); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How this new code actually retrieves the Scylla version? Or, if it's already retrieved, what variable stores it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, if it's already retrieved, what variable stores it?
The version
variable.
// Initialize the iterator | ||
iterator_ = cass_iterator_from_collection(value); | ||
|
||
// Determine if the collection is empty (null) | ||
const CassValue* check_value = cass_iterator_get_value(iterator_.get()); | ||
if (check_value) { | ||
is_null_ = false; | ||
} | ||
// We already checked that collection is not null. | ||
is_null_ = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this is an unpleasant peculiarity, empty collections seem to be identical to NULL values for the DB. See scylladb/scylla-rust-driver#1007 for reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered making position
field a non-Option
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to dive too deep into the code (because I have other tasks to do), but I think we should do our best to make the cpp-rust-driver's behaviour consistent with what the official cpp-driver's tests expect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to dive too deep into the code (because I have other tasks to do), but I think we should do our best to make the cpp-rust-driver's behaviour consistent with what the official cpp-driver's tests expect.
It was my understanding that this is what this PR does. Is that not the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this is an unpleasant peculiarity, empty collections seem to be identical to NULL values for the DB. See scylladb/scylla-rust-driver#1007 for reference.
Good catch. I'll add the is_null_
initialization here. However, I still think that iterator should not be used for checking if collection is empty. The iterator, when created, is UNINITIALIZED - to retrieve the first value, we should firstly advance the iterator via cass_iterator_next
. I don't want to advance the iterator just to check if it's empty. I'll adjust the code so we make use of cass_value_item_count
function, which can be used to see if collection is empty.
a954104
to
414817c
Compare
v2: addressed review comments |
414817c
to
303db16
Compare
size_t collection_size = cass_value_item_count(value); | ||
if (collection_size > 0) { | ||
is_null_ = false; | ||
} | ||
|
||
// Initialize the iterator | ||
iterator_ = cass_iterator_from_collection(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you drop this line then ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. iterator_
is a field. This code is called when constructor is called, and so this line initializes a field of a new object.
For some reason `ccm <node> version`` for scylla cluster always returns 3.0.8. To return a correct scylla version, we need to make use of `ccm <node> versionfrombuild`.
Retrieve a scylla version from CLI, instead of hardcoding it to 3.0.8
Some Scylla tests were unnecesarily skipped because of minimal required version for cassandra. Let's skip the check for Scylla clusters. We will add those check in the future if it's necessary to do so. As of now, they are not needed.
cass_cluster_set_no_compact is not implemented, so the corresponding test should be disabled. Now, it is "passing", since it is being skipped due to cassandra version filtering. It won't be true after the next commit.
Previously, we would return a MapIterator from cass_iterator_from_collection in case map value was passed. This approach is not consistent with cpp-driver's logic. We should return: - CollectionIterator from cass_iterator_from_collection (for lists, sets, maps and tuples) - MapIterator only if user called cass_iterator_from_map directly
`cass_iterator_get_value` function should not be used to determine whether the collection is empty... It was working for cpp-driver, since this function always returns a non-null pointer there. In case of cpp-rust-driver, we return a null pointer when user calls `cass_iterator_get_value` before `cass_iterator_next`, because the latter function is responsible for advancing the iterator, whose state is uninitialized upon creation (position is None). OTOH, cpp-driver returns a pointer to uninitialized value when calling `cass_iterator_get_value` first - this is why `is_null_` was always false for cpp-driver. Now, to check if collection is empty, we make use of `cass_value_item_count` API function.
Two previous commits fixed the issues that forced us to modify the logic for collection types tests. Since the issues are fixed, we can revert these changes.
303db16
to
d5cff5c
Compare
v2.1: Addressed @dkropachev 's review comments. |
Fix: #144
This PR addresses multiple issues:
Skipped tests for scylla clusters
As linked issue mentions,
ccm <node> version
for scylla clusters always returns3.0.8
version which I believe is hardcoded. Because of that, some tests were unnecessarily skipped. To retrieve scylla version, we should useccm <node> versionfrombuild
.I adjusted the logic for retrieving the Scylla version. Apart from that, I skip the version checks for Scylla, since the feature to version mapping is not the same for Scylla and Cassandra. I left the checks for Cassandra. As of now, I don't think it's really important to check which features should be tested based on Scylla version, since we don't plan to test old Scylla versions. We will add such filters in the future, once they are needed.
No compact test
Previously, this test was silently passing as it was skipped for both Scylla and Cassandra. However, the function
cass_cluster_set_no_compact
is not even implemented. I removed this test from CI (for both Scylla and Cassandra).Map collection iterator
cpp-rust-driver's implementation of
cass_iterator_from_collection
for maps was inconsistent with cpp-driver's implementation. This PR fixes it. I found this bug, because the test for amap<int, duration>
type was handled a bit differently than for the other types (since apparently,duration
cannot be used as a primary key). This test was failing due to the bug with map iterators.Collection objects in test framework
The
Collection
object was not initialized correctly when constructed fromCassValue
. An issue is described in detail in a corresponding commit.Modified tests for collections
Due to the two previous bugs, the tests for collections were modified a bit in the past. Since the issues are fixed, I reverted these changes and the tests now contain original logic from the upstream.
Duration tests for cassandra
Enabled duration tests for cassandra.
Scylla version in CI
Bumped Scylla version in CI to
6.0.0
.Pre-review checklist
.github/workflows/build.yml
ingtest_filter
..github/workflows/cassandra.yml
ingtest_filter
.